A power switch is positioned on a motherboard of an electronic device, and is configured to control the electronic device to power on or power-off. However, when the power switch is pressed by a mistake during test or manufacture, the program operating on the motherboard will be fault, or the test will be executed again.